[pipelines] add PNPM_CONFIG_REGISTRY endpoint - #11700
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates TypeSpec’s publishing/regeneration pipelines and Docker build to support pnpm v11+ configuration via pnpm_config_* / PNPM_CONFIG_* variables, including allowing a registry endpoint override for compliance scenarios.
Changes:
- Propagate
.npmrcvia bothNPM_CONFIG_USERCONFIGandPNPM_CONFIG_USERCONFIGfor tsp-client-driven installs. - Write both
npm_config_registryandpnpm_config_registryinto a temporary.envfor regeneration flows. - Add an overridable
NPM_REGISTRYpipeline variable and pass it into the Docker build as--build-arg NPM_REGISTRY=..., plus set pnpm/npm registry env vars in the Dockerfile.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/http-client-csharp/eng/scripts/Submit-AzureSdkForNetPr.ps1 | Sets NPM_CONFIG_USERCONFIG and PNPM_CONFIG_USERCONFIG so tsp-client can resolve packages using the repo .npmrc. |
| packages/http-client-csharp/eng/scripts/RegenPreview.ps1 | Writes both npm and pnpm registry env vars to a temporary .env for tsp-client execution. |
| packages/http-client-csharp/eng/pipeline/publish.yml | Adds pnpm-related pipeline variables (store/cache/force) alongside npm variables. |
| eng/tsp-core/pipelines/publish.yml | Introduces an npmRegistry variable (overridable via NPM_REGISTRY) and passes it as a Docker build-arg. |
| docker/Dockerfile | Accepts NPM_REGISTRY build-arg and sets npm/pnpm registry env vars for dependency installs in the build stages. |
Suppressed comments (1)
docker/Dockerfile:37
- The final stage also defaults
ARG NPM_REGISTRY=to empty and then setsNPM_CONFIG_REGISTRYto that value. For docker builds that don’t pass the build-arg, this can force npm’s registry to an empty value duringnpm install -g /tmp/compiler.tgz, which can break dependency resolution.
# Inherit registry setting for final stage
ARG NPM_REGISTRY=
ENV NPM_CONFIG_REGISTRY=${NPM_REGISTRY}
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| # Optional: Override npm registry for CFS compliance. | ||
| # pnpm 11+ requires PNPM_CONFIG_REGISTRY (ignores NPM_CONFIG_REGISTRY). | ||
| ARG NPM_REGISTRY= | ||
| ENV PNPM_CONFIG_REGISTRY=${NPM_REGISTRY} | ||
| ENV NPM_CONFIG_REGISTRY=${NPM_REGISTRY} | ||
|
|
- Use underscore in pnpm_config_store_dir (not hyphen) - Default NPM_REGISTRY to https://registry.npmjs.org/ instead of empty
| $originalSdkEnv = if (Test-Path $sdkEnvFile) { Get-Content $sdkEnvFile -Raw } else { $null } | ||
| Set-Content $sdkEnvFile "npm_config_registry=$artifactFeedRegistry`n" -Encoding utf8 -NoNewline | ||
| # Set both npm and pnpm registry env vars (pnpm 11+ ignores npm_config_* prefix) | ||
| Set-Content $sdkEnvFile "npm_config_registry=$artifactFeedRegistry`npnpm_config_registry=$artifactFeedRegistry`n" -Encoding utf8 -NoNewline |
There was a problem hiding this comment.
we don't use pnpm when running this script. It's primarily used locally. Do we need this change here? If so, do we need to add some delimiter between the 2 registry values ?
commit: |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
Suppressed comments (1)
docker/Dockerfile:36
- Final Docker image stage only sets NPM_CONFIG_REGISTRY, but the earlier comment states pnpm 11+ requires PNPM_CONFIG_REGISTRY. If any runtime path uses pnpm (e.g.,
tsp installor future additions), the overridden registry won't apply in the final image. Set PNPM_CONFIG_REGISTRY in the final stage as well to truly inherit the registry setting.
# Inherit registry setting for final stage
ARG NPM_REGISTRY=https://registry.npmjs.org/
ENV NPM_CONFIG_REGISTRY=${NPM_REGISTRY}
|
You can try these changes here
|
No description provided.